<template>
  <el-cascader
    ref="formItem"
    v-model="valueTmp"
    v-bind="{...defaultAttrs, ...$attrs, ...item.attrs }"
    v-on="$listeners"
    @change="change"
    @expand-change="expandChange"
  />
</template>

<script>
import formItemMixin from './form-item-mixin'
export default {
  name: 'Cascader',
  mixins: [formItemMixin],
  data() {
    return {
      defaultAttrs: {
        placeholder: '请选择',
        clearable: true
      }
    }
  },
  methods: {
    change(args) {
      this.$emit('update:value', args)
      if (this.item && this.item.onChange) {
        this.item.onChange(args)
      }
    }
  }
}
</script>

<style scoped></style>
